<!DOCTYPE html>
<html>
<head>
<title> EventLister member: handleEvent() </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>

<table id="table" border="1" style="display: none">
    <tbody id="table-body">
    <tr id="table-row">
        <td id="table-cell">Shady Grove</td>
        <td>Aeolian</td>
    </tr>
    <tr id="parent">    
        <td id="target">Over the river, Charlie</td>
        <td>Dorian</td>
    </tr>
    </tbody>
</table>
        
<script>
    var EVENT = "foo";
    var TARGET = document.getElementById("target");
    var TestResult = false;

    var description = "Test Description: " + 
                      "handleEvent - This method shall be called whenever an event occurs of the event type for " +
                      "which the EventListener interface was registered.";
    
    var EventListener = {};
    EventListener.handleEvent = function(evt) 
    {
        if ((EVENT == evt.type) && (TARGET == evt.target) && (this === EventListener))
        {
            TestResult = true;    
        }
        else
        {
            TestResult = false;
        }
    }

    test(function()
    {
        var evt = document.createEvent("Event");
        evt.initEvent(EVENT, true, true);
        
        TARGET.addEventListener(EVENT, EventListener, true);
        TARGET.dispatchEvent(evt);
        TARGET.removeEventListener(EVENT, EventListener, true);

        assert_true(TestResult);

    }, description);
</script>
</body>
</html>
